#ifndef GLOBALDEFINITIONS_H_
#define GLOBALDEFINITIONS_H_

#define EXIT_SUCCESS 0
#define EXIT_FAILURE 0


#define SET_BIT(BYTE, BIT) 		BYTE |= (1<<BIT)
#define CLEAR_BIT(BYTE, BIT) 	BYTE &= ~(1<<BIT)

#define DDRLED					DDRB
#define PORTLED					PORTB
#define LED1					PB7
#define LED_TOGGLE(LED)			PORTLED ^=  (1<<(LED))
#define LED_ON(LED)				CLEAR_BIT(PORTLED, LED)
#define LED_OFF(LED)			SET_BIT(PORTLED, LED)

#define F_CPU					16000000UL
#define UART_BAUDRATE			76800

typedef struct
{
 	volatile uint8_t fanpwm_ch0;
	volatile uint8_t ledpwm_ch0;
	volatile uint8_t ledpwm_ch1;
	volatile uint8_t ledpwm_ch2;
	volatile uint8_t ledpwm_ch3;

	volatile uint8_t dimm_ch0;
	volatile uint8_t dimm_ch1;
	volatile uint8_t dimm_ch2;

	volatile uint8_t io;
	volatile uint8_t relay;

	volatile uint8_t tempair_t0;
	volatile uint8_t tempair_t1;
	volatile uint8_t tempair_t2;
	volatile uint8_t tempair_t3;
	volatile uint8_t tempair_t4;
	volatile uint8_t tempair_t5;
	volatile uint8_t tempair_t6;
	volatile uint8_t tempair_t7;

	volatile uint16_t tempwater_t0;
	volatile uint16_t tempwater_t1;

	volatile uint16_t fanrpm_v0;
	volatile uint16_t fanrpm_v1;
	volatile uint16_t fanrpm_v2;
	volatile uint16_t fanrpm_v3;

}S_DATA;
S_DATA s_data;

typedef struct
{
    volatile uint8_t fanpwm_ch0;
    volatile uint8_t fanpwm_ch1;
    volatile uint8_t fanpwm_ch2;

    volatile uint8_t ledpwm_ch0;
    volatile uint8_t ledpwm_ch1;
    volatile uint8_t ledpwm_ch2;

    volatile uint8_t dimm_ch0;
    volatile uint8_t dimm_ch1;

    volatile uint8_t io;
    volatile uint8_t relay;

}S_SEND_DATA;
S_SEND_DATA s_send_data;



#endif

